<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>indent</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="language.modifiers.html" title="Chapter 5. Variable Modifiers">
<link rel="prev" href="language.modifier.from_charset.html" title="from_charset">
<link rel="next" href="language.modifier.lower.html" title="lower">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">indent</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="language.modifier.from_charset.html">Prev</a> </td>
<th width="60%" align="center">Chapter 5. Variable Modifiers</th>
<td width="20%" align="right"> <a accesskey="n" href="language.modifier.lower.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="indent">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="language.modifier.indent"></a>indent</h2></div></div></div>
<p>
     This indents a string on each line, default is 4. As
     an optional parameter, you can specify the number of characters to
     indent. As an optional second parameter, you can specify the
     character to use to indent with eg use <code class="literal">"\t"</code> for a tab.
  </p>
<div class="informaltable"><table border="1">
<colgroup>
<col align="center">
<col align="center">
<col align="center">
<col align="center">
<col>
</colgroup>
<thead><tr>
<th align="center">Parameter Position</th>
<th align="center">Type</th>
<th align="center">Required</th>
<th align="center">Default</th>
<th>Description</th>
</tr></thead>
<tbody>
<tr>
<td align="center">1</td>
<td align="center">integer</td>
<td align="center">No</td>
<td align="center">4</td>
<td>This determines how many characters to indent
       to.</td>
</tr>
<tr>
<td align="center">2</td>
<td align="center">string</td>
<td align="center">No</td>
<td align="center">(one space)</td>
<td>This is the character used to indent with.</td>
</tr>
</tbody>
</table></div>
<div class="example">
<a name="id353973"></a><p class="title"><b>Example 5.12. indent</b></p>
<div class="example-contents">
<pre class="programlisting">

&lt;?php

$smarty-&gt;assign('articleTitle',
                'NJ judge to rule on nude beach.
Sun or rain expected today, dark tonight.
Statistics show that teen pregnancy drops off significantly after 25.'
                );
?&gt;

   </pre>
<p>
    Where template is:
   </p>
<pre class="programlisting">

{$articleTitle}

{$articleTitle|indent}

{$articleTitle|indent:10}

{$articleTitle|indent:1:"\t"}

   </pre>
<p>
    Will output:
   </p>
<pre class="screen">

NJ judge to rule on nude beach.
Sun or rain expected today, dark tonight.
Statistics show that teen pregnancy drops off significantly after 25.

    NJ judge to rule on nude beach.
    Sun or rain expected today, dark tonight.
    Statistics show that teen pregnancy drops off significantly after 25.

          NJ judge to rule on nude beach.
          Sun or rain expected today, dark tonight.
          Statistics show that teen pregnancy drops off significantly after 25.

        NJ judge to rule on nude beach.
        Sun or rain expected today, dark tonight.
        Statistics show that teen pregnancy drops off significantly after 25.

   </pre>
</div>
</div>
<br class="example-break"><p>
   See also
   <a class="link" href="language.modifier.strip.html" title="strip"><code class="varname">strip</code></a>,
   <a class="link" href="language.modifier.wordwrap.html" title="wordwrap"><code class="varname">wordwrap</code></a>
   and
   <a class="link" href="language.modifier.spacify.html" title="spacify"><code class="varname">spacify</code></a>.
  </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="language.modifier.from_charset.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="language.modifiers.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="language.modifier.lower.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">from_charset </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> lower</td>
</tr>
</table>
</div>
</body>
</html>
